<template>
  <div>
    <div id="printTest">
      <el-container>
        <el-header >
          <label class="number-word" style="margin-left: 20px">海宁宏亚包装有限公司销售配送单</label>
          <span class="tableTitle" ></span>
        </el-header>
        <el-main style="margin-left:10%;margin-right:10%">
          <div  style="text-align:left">
            <div :data="Cusdata">
              <el-row>
                <el-col :span="8"><label >客户名称：{{Cusdata.customerName}}</label></el-col>
                <el-col :span="8"><label >联系人：{{Cusdata.linkPerson}}</label></el-col>
                <el-col :span="8"><label >联系方式：{{Cusdata.linkPhone}}</label></el-col>
              </el-row>
            </div>
            <div :data="Orderdata">
              <el-row>
                <el-col :span="8"><label >订单编号：{{Orderdata.orderNo}}</label></el-col>
                <el-col :span="8"><label >订单时间：{{Orderdata.orderTime}}</label></el-col>
              </el-row>
              <el-row>
                <el-col  ><strong>物流信息：{{Orderdata.logisticinfo}}</strong></el-col>
              </el-row>
              <el-row>
                <el-col  ><strong>订单备注：{{Orderdata.remark}}</strong></el-col>
              </el-row>
            </div>

            <el-row>
              <el-col style="font-size: 20px;margin-top:80px;"><label >订单产品明细</label></el-col>
            </el-row>

            <div>
              <el-table
                :data="OrDetaildata"
                style="width: 100%">
                <el-table-column
                  prop="productNo"
                  label="产品编号"
                  width="200">
                </el-table-column>
                <el-table-column
                  prop="productName"
                  label="产品名称"
                  width="200">
                </el-table-column>
                <el-table-column
                  prop="spec"
                  label="产品规格"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="unit"
                  label="单位"
                  width="80">
                </el-table-column>
                <el-table-column
                  prop="orderAmount"
                  label="产品数量"
                  width="150">
                </el-table-column>
                <el-table-column
                  prop="amount"
                  label="总计数量">
                </el-table-column>
              </el-table>
            </div>

          </div>
        </el-main>
      </el-container>
    </div>
    <el-footer>
      <el-button type="primary" v-print="'#printTest'">打印</el-button>
      <el-button type="primary" @click="goback">返回</el-button>
    </el-footer>
  </div>
</template>

<script>
  export default {
    name: "print",
    data(){
      return {
        OrDetaildata: [],
        Orderdata: [],
        Cusdata: [],
        orderNo:"",
        customerNo:""
      }
    },
    created(){
      this.Cusdata=[]
      this.OrDetaildata=[]
      this.Orderdata=[]
      this.orderNo=this.$route.query.orderNo
      this.customerNo=this.$route.query.customerNo
      this.xuanran()
    },
    methods: {
      xuanran() {
        let params={
          "orderNo":this.orderNo,
        }
        this.$http.post("/hnhyscms_ws/orderdetails/getByOrderNo",params, {emulateJSON: true}).then(
          success => {
            this.OrDetaildata = success.data
          }
        )
        this.$http.post("/hnhyscms_ws/orders/getByOrderNo",params, {emulateJSON: true}).then(
          success => {
            this.Orderdata = success.data
            console.log(this.Orderdata)
          }
        )
        let param={
          "customerNo":this.customerNo,
        }
        this.$http.post("/hnhyscms_ws/customers/getByCustomerNo",param, {emulateJSON: true}).then(
          success => {
            this.Cusdata = success.data
          }
        )
      },
      goback(){
        this.$router.go(-1)
      }
    }
  }
</script>

<style scoped>
  .number-word {
    font-size: 30px;
    line-height:50px;
    margin-left: -1300px;
  }
  .tableTitle {
    margin: 0 auto;
    width: 600px;
    height: 1px;
    background-color: #d4d4d4;
    color: rgb(0, 0, 0);
  }
</style>
